package com.bajie.bjlisten.mapper;

import com.bajie.bjlisten.entity.BJMenuChild;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BjMenuMapper {

    //查询所有菜单列表
    List<BJMenuChild> findListAll();

    //查询父菜单
    List<BJMenuChild> findListParents();

    //根据用户ID查询
    List<BJMenuChild> findListByUserId(@Param("user_id") String user_id);

    //根据角色ID查询
    List<BJMenuChild> findlListByRoleId(@Param("role_id") String role_id);


    //通过角色ID查询权限
    BJMenuChild getMenuById(String id);

    //添加菜单权限
    int saveMenu(BJMenuChild permission);

    //更新菜单
    int updateMenu(BJMenuChild permission);

    //根据ID删除
    int deleteById(String id);

    //根据父ID删除
    int deleteByParentId(String p_id);

    //根据菜单ID删除
    int deleteRolePermission(String menu_id);
}
